package com.temi.iot.controller;


import com.temi.iot.common.constant.result.Page;
import com.temi.iot.common.constant.result.Result;
import com.temi.iot.entity.SysPermission;
import com.temi.iot.service.ISysPermissionService;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author one
 * @since 2019-12-11
 */
@RestController
@RequestMapping("/sys-permission")
public class SysPermissionController {

    @Autowired
    private ISysPermissionService sysPermissionService;

    @ApiOperation("增加权限")
    @PostMapping
    public Result inserPermission(SysPermission sysPermission){
        return sysPermissionService.insertPermission(sysPermission);
    }


    @ApiOperation("修改权限")
    @PutMapping
    public Result updatePermission(SysPermission sysPermission){
        return sysPermissionService.updatePermission(sysPermission);
    }

    @ApiOperation("删除权限")
    @DeleteMapping
    public Result deletePermission(Long id){
        return sysPermissionService.deletePermission(id);
    }

    @ApiOperation("权限详情")
    @GetMapping
    public Result selectPermissionDetail(Long id){
        return sysPermissionService.selectPermissionDetail(id);
    }

    @ApiOperation("权限列表")
    @GetMapping("/list")
    public Page selectPermissionList(){
        return sysPermissionService.selectPermissionList();
    }


}
